-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add "Content-Security-Policy" to speculation rules explainer #209
Conversation
The new section explains how the prerender and prefetch follow the Content-Security-Policy. They are not restricted by `script-src`, but done by `prefetch-src`. This makes speculationrules safer and flexible.
@jeremyroman can you take a look? |
It's not clear to me that this is the right approach. The discussion @arturjanc started in w3c/webappsec-csp#472 landed on using the same |
Yeah, I think we landed at It's a little tricky because it's more active than most subresources would be, even though it's not as powerful as JavaScript. |
The problem of using |
I did mention that case in w3c/webappsec-csp#472 (comment). I don't know whether I could certainly see a separate directive (which should probably default to |
The main motivation is that we are only using Note that this case is different than |
@jeremyroman thank you for sharing your comment that discussed the same problem before. In the comment, I agreed that there are two aspects to restrict prerendering; 1) speculationrules injection sources, and 2) prerendering targets. Having a dedicated rule like I'm quite new to |
There's a I don't have a strong objection to the model you're proposing here. I think I agree with you that controling the set of things that are prefetched isn't terribly dangerous, with the only risk being exfiltration that we should be able to handle via other rules. That said, I do prefer to keep developer's mental models around
If this is what you're doing, why not continue using
and
That model seems clearer to me than imbuing |
I have to admit that I am worried about this change and think it will result in a security regression for existing sites using CSP. The reason for this is that a lot of websites have policies that use I also agree with @mikewest's argument about it being simpler conceptually if Given all of this, my guess is that it will be simpler to keep this gated on |
I don't know much history and reasons to decide using If I stick to my proposal, the risk @arturjanc raised can be solved if we also introduce |
Having some So my initial thought was leaning toward either:
|
Thank you for duscssion. I agreed that my proposal would introduce a confusion around the relationship between During a local chat, @domenic thinks of an interesting idea to introduce a new |
Here is a draft for the new proposal. I will make another PR if there is no objection here.
|
To @jeremyroman @mikewest @arturjanc @hiroshige-g |
The Yes, a fresh syntax could have been developed which was suitable for use in HTML attributes (and defined a processing model contrary to the existing Personally I think of A separate |
Thank you @jeremyroman for the inputs on the reasoning of using the script tag. Thank you everyone for the great discussion! |
Let me close this PR in favor or #213 |
The new section explains how the prerender and prefetch follow the Content-Security-Policy. They are not restricted by
script-src
, but done byprefetch-src
. This makes speculationrules safer and flexible.